/// 一个查找三维特征的类
/// 
#ifndef MEBLOBDECTOR_H
#define MEBLOBDECTOR_H

#include <opencv2/core.hpp>

struct MeBlobParams
{
    float threshold = 80.0;
    float minDistBetweenBlobs;
    
    bool filterByArea = true;
    float minArea = 35, maxArea = 2500;
    
    bool filterByCircularity = true;
    float minCircularity = 0.6, maxCircularity=std::numeric_limits<float>::max();
    
    float level = 40;   // min = level - window/2
    float window = 400;
};

class MeKeyPoint
{
public:
    cv::Point2f pt; // 点
    float area; // 面积
    float diameter; // 半径
    float circularity; 
    float z = 0;
};

class MeBlobDector
{
public:
    /// 是被一幅图的特征点
    static int fastBlob2DDetect(const cv::Mat& grayImg, const cv::Mat& binaryImg, MeBlobParams &params, 
                              int z, std::vector<MeKeyPoint>& keyPoints);
    
    /// 二值化图像并计算坐标
    /// pData 输入三维图像数据
    /// dims 三维空间尺寸
    /// spacing 像素间隔尺寸
    static void computeBlob3DPos(short *pData, int dims[3], double spacing[3], MeBlobParams &blobParams, std::vector<cv::Point3f> &resultPoint);
};

#endif // MESMALLBALLDECTOR_H
